package site.wtcc.originalfavor.func.common.persistence;

import lombok.Data;

/**
 * @author hxd
 */
@Data
public class BasePageRequest {
    private static final long serialVersionUID = 6800879676466447183L;

    private Integer page;

    private Integer pageCount;
    /**
     * sql中实际的第一个参数
     */
    private Integer pageIndex;

    public Integer getPage() {
        if (page == null || page <= 0) {
            page = 1;
        }
        return page;
    }

    public Integer getPageCount() {
        if (pageCount == null || pageCount <= 0) {
            pageCount = 10;
        }
        return pageCount;
    }

    public Integer getPageIndex() {
        if (page <= 1) {
            pageIndex = 0;
        } else {
            pageIndex = (page - 1) * pageCount;
        }
        return pageIndex;
    }


}
